import request from '@/utils/request'

// 查询生产计划列表
export function listSchedule(query) {
  return request({
    url: '/yyj/pro/schedule/list',
    method: 'get',
    params: query
  })
}

// 查询条件
export function conditionSchedule() {
  return request({
    url: '/yyj/pro/schedule/condition',
    method: 'get'
  })
}

// 查询生产计划详细
export function getSchedule(scheduleCode) {
  return request({
    url: '/yyj/pro/schedule/' + scheduleCode,
    method: 'get'
  })
}

// 新增生产计划
export function addSchedule(data) {
  return request({
    url: '/yyj/pro/schedule',
    method: 'post',
    data: data
  })
}

// 修改生产计划
export function updateSchedule(data) {
  return request({
    url: '/yyj/pro/schedule',
    method: 'put',
    data: data
  })
}

// 分解生产计划
export function decomposeSchedule(data) {
  return request({
    url: '/yyj/pro/schedule/decompose',
    method: 'put',
    data: data
  })
}

// 获取相关生产工单
export function getOrders(scheduleCode) {
  return request({
    url: '/yyj/pro/schedule/getOrders',
    method: 'get',
    params: { scheduleCode }
  })
}

// 删除生产计划
export function delSchedule(scheduleCode) {
  return request({
    url: '/yyj/pro/schedule/' + scheduleCode,
    method: 'delete'
  })
}
